package com.Demo.scanner;

import java.util.Scanner;

/*
    求3个数的较大值
 */
public class ScannerTest {
    public static void main(String[] args) {

        //逻辑运算
        System.out.println(3 & 2);//2
        System.out.println(3 | 2);//3
        System.out.println(3 ^ 2);//1

        //位移运算
        System.out.println(4 >> 1);//2
        System.out.println(4 << 1);//8


        //键盘录入三个变量
        Scanner sc = new Scanner(System.in);
        //提示
        System.out.println("请您输入第一个整数:");
        int a = sc.nextInt();
        //提示
        System.out.println("请您输入第二个整数:");
        int b = sc.nextInt();
        //提示
        System.out.println("请您输入第三个整数:");
        int c = sc.nextInt();

        //先求2个数的较大值
        int temp = a > b ? a : b;
        //拿中间变量temp和第三个数进行比较
        int max = temp > c ? temp : c;

        System.out.println("max = " + max);


    }
}
